﻿#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QPushButton>
#include <QtSerialPort/QSerialPort>
#include <QtSerialPort/QSerialPortInfo>

QT_BEGIN_NAMESPACE
namespace Ui { class Form; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

protected:
    void keyPressEvent(QKeyEvent *ev);
private slots:
    void PortScan(void);
    void on_OpenSerialButton_clicked();
    void ReadData();
    void on_SendButton_clicked();

private:

    QString PortNameSave;
    QSerialPort *Uart;
    QTimer *PortScanTimer;       //周期性扫描串口
    Ui::Form *ui;
};
#endif // MAINWINDOW_H
